package com.controller;

import java.util.List;

import com.dao.CotacaoDao;
import com.database.TransactionManager;
import com.model.CotacaoBean;

public class CotacaoController {

	public void inserir(TransactionManager transaction, Integer prodId, Integer empId, String data, String hora, Double valor){
		//
		CotacaoBean bean = new CotacaoBean();
		bean.getProd().setId(prodId);
		bean.getEmp().setId(empId);
		bean.setData(data);
		bean.setHora(hora);
		bean.setValor(valor);
		//
		CotacaoDao dao = new CotacaoDao();
		dao.insert(transaction, bean);

	}
	
	public void update(TransactionManager transaction, Integer prodId, Integer empId, String data, String hora, Double valor){
		//
		CotacaoBean bean = new CotacaoBean();
		bean.getProd().setId(prodId);
		bean.getEmp().setId(empId);
		bean.setData(data);
		bean.setHora(hora);
		bean.setValor(valor);
		//
		CotacaoDao dao = new CotacaoDao();
		dao.update(transaction, bean);
	}
	
	public void delete(TransactionManager transaction, Integer prodId, Integer empId, String data, String hora, Double valor){
		//
		CotacaoBean bean = new CotacaoBean();
		bean.getProd().setId(prodId);
		//
		CotacaoDao dao = new CotacaoDao();
		dao.delete(transaction, bean);
	}
	
	public List<CotacaoBean> CotList(TransactionManager transaction){
		//
		CotacaoDao dao = new CotacaoDao();
		List<CotacaoBean> beanList = dao.getAll(transaction);
		return beanList;
	}

}
